package com.lsl.crm.struts;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.lsl.crm.function.CrmDao;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport{
	private CrmDao icd;

	
	public CrmDao getIcd() {
		return icd;
	}


	public void setIcd(CrmDao icd) {
		this.icd = icd;
	}


	public String login(){
		HttpServletRequest request = ServletActionContext.getRequest();
		String name=request.getParameter("name");
		String password=request.getParameter("password");
		String result=icd.login(name, password);
		if(!"".equals(result)){
			result=SUCCESS;
		}else{
			String flag="false";
			ActionContext.getContext().put("flag", flag);
			result=ERROR;
		}
		return result;
	}
}
